<!-- 支付配置 -->
<template>
  <a-card style="width: 100%" :tab-list="tabListNoTitle" :active-tab-key="titleKey" @tabChange="key => onTabChange(key)"
    :bordered="false" class="br-10">
    <Pay v-if="titleKey === 'pay'" />
    <OnlinePayment v-else-if="titleKey === 'onlinePayment'" />
  </a-card>
</template>

<script>
import Pay from './pay'
import OnlinePayment from './onlinePayment'

export default {
  components: {
    Pay,
    OnlinePayment
  },
  data() {
    return {
      tabListNoTitle: [
        {
          key: 'pay',
          tab: '收款方式设置'
        },
        {
          key: 'onlinePayment',
          tab: '开通线上支付'
        }
      ],
      titleKey: 'pay'
    }
  },
  computed: {},
  watch: {
    '$route.query.titleKey'() {
      this.titleKey = this.$route.query.titleKey || 'pay'
    }
  },
  methods: {
    onTabChange(key) {
      this.$router.push({
        path: '/system/paySettings',
        query: {
          titleKey: key
        }
      })
    }
  },
  created() { },
  mounted() {
    this.$router.push({
      path: '/system/paySettings',
      query: {
        titleKey: this.$route.query.titleKey || 'pay'
      }
    })
    this.titleKey = this.$route.query.titleKey || 'pay'
  }

}
</script>
<style scoped></style>
